$(function () {
	var tmpl = '<li class="weui-uploader__file" style="background-image:url(#url#)"></li>';
	var src, url = window.URL || window.webkitURL || window.mozURL;
    new AjaxUpload('#upload', {
        action: '../seller/upload',
        name: 'file',
        data: {resId:$("#resId").val()},
        autoSubmit:true,
        responseType:"json",
        onSubmit:function(file, extension){
            if (!(extension && /^(jpg|jpeg|png|gif)$/.test(extension.toLowerCase()))){
                alert('只支持jpg、png、gif格式的图片！');
                return false;
            }
        },
        onComplete : function(file, r){
        	$uploaderFiles = $("#uploaderFiles")
            if(r.code == 0){
                $uploaderFiles.append($(tmpl.replace('#url#', r.url)));
            }else{
                alert(r.msg);
            }
        }
    });

});

